package com.zat.mes.andrmes.dofun.work.adapter

import android.text.TextUtils
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.GetPackBean

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description: 领取裁片包
 */
class GetPackAdapter(layoutResId: Int) :
    BaseQuickAdapter<GetPackBean, BaseViewHolder>(layoutResId), LoadMoreModule {

    override fun convert(helper: BaseViewHolder, item: GetPackBean) {
        helper.setText(R.id.tvProduceNameGetItem, item?.productName)
        helper.setText(
            R.id.tvStyleNoGetItem,
            context.getString(R.string.text_style) + "：" + item?.styleNO
        )
        helper.setText(
            R.id.tvPackNoGetItem,
            context.getString(R.string.text_pack_no) + "：" + item?.packNO
        )
        helper.setText(
            R.id.tvColorGetItem,
            context.getString(R.string.text_color) + "：" + item?.color
        )
        val textGroupNo = helper.getView<TextView>(R.id.tvGroupNoGetItem)
        if (TextUtils.isEmpty(item?.groupNo)){
            textGroupNo.text = "拼片组编号：-"
        }else{
            textGroupNo.text = "拼片组编号："+item?.groupNo
        }
        helper.setText(R.id.tvSizeGetItem, context.getString(R.string.text_size) + "：" + item?.size)
        helper.setText(R.id.tvDateGetItem, item?.reveiveTime)
    }
}